package com.rising.spring.service.impl;

import com.rising.spring.bean.Fruit;
import com.rising.spring.service.FruitService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class FruitServiceImpl implements FruitService {

    public FruitServiceImpl() {
        System.out.println("构建水果服务");
    }

    @Autowired
    private Fruit apple;

    @Resource
    private Fruit orange;

    @Override
    public void eatFruit() {
        apple.eat();
        orange.eat();
    }

    public Fruit getApple() {
        return apple;
    }


    public void setApple(Fruit apple) {
        System.out.println("注入大苹果");
        this.apple = apple;
    }
}
